home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / MHITU.C < prev    next >
C/C++ Source or Header  |  1993-03-16  |  49KB  |  1,906 lines

  1. /*    SCCS Id: @(#)mhitu.c    3.0    89/11/27
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include    "hack.h"
  6. #ifdef NAMED_ITEMS
  7. #  include "artifact.h"
  8. #endif
  9.  
  10. STATIC_VAR struct obj NEARDATA *otmp;
  11.  
  12. #ifdef POLYSELF
  13. STATIC_DCL void FDECL(urustm, (struct monst *, struct obj *));
  14. # ifdef OVL1
  15. static int FDECL(passiveum, (struct permonst *,struct monst *,struct attack *));
  16. # endif /* OVL1 */
  17. #endif /* POLYSELF */
  18.  
  19. #ifdef OVLB
  20. # ifdef SEDUCE
  21. static void FDECL(mayberem, (struct obj *, const char *));
  22. # endif
  23. #endif /* OVLB */
  24.  
  25. STATIC_DCL int FDECL(hitmu, (struct monst *,struct attack *));
  26. STATIC_DCL int FDECL(gulpmu, (struct monst *,struct attack *));
  27. STATIC_DCL int FDECL(explmu, (struct monst *,struct attack *));
  28. STATIC_DCL int FDECL(gazemu, (struct monst *,struct attack *));
  29. STATIC_DCL void FDECL(missmu,(struct monst *,BOOLEAN_P,struct attack *));
  30. STATIC_DCL void FDECL(mswings,(struct monst *,struct obj *));
  31. STATIC_DCL void FDECL(wildmiss,(struct monst *));
  32.  
  33. STATIC_DCL void FDECL(hurtarmor,(struct permonst *,int));
  34.  
  35. #ifdef OVL1
  36.  
  37. static void FDECL(hitmsg,(struct monst *,struct attack *));
  38.  
  39. static void
  40. hitmsg(mtmp, mattk)
  41. register struct monst *mtmp;
  42. register struct attack *mattk;
  43. {
  44.     int compat;
  45.  
  46.     /* Note: if opposite gender, "seductively" */
  47.     /* If same gender, "engagingly" for nymph, normal msg for others */
  48.     if((compat = could_seduce(mtmp, &youmonst, mattk))
  49.             && !mtmp->mcan && !mtmp->mspec_used) {
  50.             kludge("%s %s you %s.", Monnam(mtmp),
  51.             Blind ? "talks to" : "smiles at",
  52.             compat == 2 ? "engagingly" : "seductively");
  53.     } else
  54.         switch (mattk->aatyp) {
  55.         case AT_BITE:
  56.             kludge("%s bites!", Monnam(mtmp));
  57.             break;
  58.         case AT_KICK:
  59. #ifdef POLYSELF
  60.             kludge("%s kicks%c", Monnam(mtmp), thick_skinned(uasmon) ? '.' : '!');
  61. #else
  62.             kludge("%s kicks!", Monnam(mtmp));
  63. #endif
  64.             break;
  65.         case AT_STNG:
  66.             kludge("%s stings!", Monnam(mtmp));
  67.             break;
  68.         case AT_BUTT:
  69.             kludge("%s butts!", Monnam(mtmp));
  70.             break;
  71.         case AT_TUCH:
  72.             kludge("%s touches you!", Monnam(mtmp));
  73.             break;
  74.         default:
  75.             kludge("%s hits!", Monnam(mtmp));
  76.         }
  77. }
  78.  
  79. STATIC_OVL void
  80. missmu(mtmp, nearmiss, mattk)        /* monster missed you */
  81. register struct monst *mtmp;
  82. register boolean nearmiss;
  83. register struct attack *mattk;
  84. {
  85.     if(could_seduce(mtmp, &youmonst, mattk) && !mtmp->mcan)
  86.         kludge("%s pretends to be friendly.", Monnam(mtmp));
  87.     else {
  88.         if (!flags.verbose || !nearmiss)
  89.         kludge("%s misses.", Monnam(mtmp));
  90.         else
  91.         kludge("%s just misses!", Monnam(mtmp));
  92.     }
  93. }
  94.  
  95. STATIC_OVL void
  96. mswings(mtmp, otemp)        /* monster swings obj */
  97. register struct monst *mtmp;
  98. register struct obj *otemp;
  99. {
  100.     if (!flags.verbose || Blind || otemp->olet != WEAPON_SYM) return;
  101.     pline("%s %s %s %s.", Monnam(mtmp),
  102.           ((otemp->otyp >= SPEAR &&
  103.             otemp->otyp <= LANCE) ||
  104.            (otemp->otyp >= PARTISAN &&
  105.             otemp->otyp <= SPETUM) ||
  106.            otemp->otyp == TRIDENT) ? "thrusts" : "swings",
  107.           is_female(mtmp) ? "her" :
  108.           is_human(mtmp->data) ? "his" : "its",
  109.           xname(otemp));
  110. }
  111.  
  112. #endif /* OVL1 */
  113. #ifdef OVLB
  114.  
  115. STATIC_OVL void
  116. wildmiss(mtmp)        /* monster attacked your displaced image */
  117.     register struct monst *mtmp;
  118. {
  119.     int compat;
  120.  
  121.     if (!flags.verbose) return;
  122.     if (!cansee(mtmp->mx, mtmp->my)) return;
  123.         /* maybe it's attacking an image around the corner? */
  124.  
  125.     compat = could_seduce(mtmp, &youmonst, (struct attack *)0);
  126.         /* we really want to have the attack here to pass --
  127.          * the previous code checked whether mtmp was a nymph,
  128.          * which was not correct either since the attack type of
  129.          * succubi/incubi varies with SEDUCE
  130.          */
  131.  
  132.     if(Invis && !perceives(mtmp->data)) {
  133.         if(compat)
  134.         kludge("%s tries to touch you and misses!", Monnam(mtmp));
  135.         else
  136.         switch(rn2(3)) {
  137.         case 0: kludge("%s swings wildly and misses!", Monnam(mtmp));
  138.             break;
  139.         case 1: kludge("%s attacks a spot beside you.", Monnam(mtmp));
  140.             break;
  141.         case 2: kludge("%s strikes at thin air!", Monnam(mtmp));
  142.             break;
  143.         default:kludge("%s swings wildly!", Monnam(mtmp));
  144.             break;
  145.         }
  146.     }
  147.     else if(Displaced) {
  148.         if(compat)
  149.         kludge("%s smiles %s at your %sdisplaced image...",
  150.             Monnam(mtmp),
  151.             compat == 2 ? "engagingly" : "seductively",
  152.             Invis ? "invisible " : "");
  153.        else
  154.         kludge("%s strikes at your %sdisplaced image and misses you!",
  155.             /* Note: if you're both invisible and displaced,
  156.              * only monsters which see invisible will attack your
  157.              * displaced image, since the displaced image is also
  158.              * invisible.
  159.              */
  160.             Monnam(mtmp),
  161.             Invis ? "invisible " : "");
  162.     }
  163.     else impossible("%s attacks you without knowing your location?",
  164.         Monnam(mtmp));
  165. }
  166.  
  167. void
  168. expels(mtmp, mdat, message)
  169. register struct monst *mtmp;
  170. register struct permonst *mdat; /* if mtmp is polymorphed, mdat != mtmp->data */
  171. boolean message;
  172. {
  173.     if (message) 
  174.         if (is_animal(mdat)) 
  175.             You("get regurgitated!");
  176.         else {
  177.             char blast[40];
  178.             register int i;
  179.  
  180.             blast[0] = '\0';
  181.             for(i = 0; i < NATTK; i++)
  182.                 if(mdat->mattk[i].aatyp == AT_ENGL) 
  183.                     break;
  184.             if (mdat->mattk[i].aatyp != AT_ENGL)
  185.                   impossible("Swallower has no engulfing attack?"); 
  186.             else {
  187.                 if (is_whirly(mdat)) {
  188.                     switch (mdat->mattk[i].adtyp) {
  189.                         case AD_ELEC:
  190.                             Strcpy(blast, 
  191.                               " in a shower of sparks");
  192.                             break;
  193.                         case AD_COLD:
  194.                             Strcpy(blast, 
  195.                             " in a blast of frost");
  196.                             break;
  197.                     }
  198.                 } else
  199.                     Strcpy(blast, " with a squelch");
  200.                 You("get expelled from %s%s!", 
  201.                     mon_nam(mtmp), blast);
  202.             }
  203.         }
  204.     unstuck(mtmp);
  205.     mnexto(mtmp);
  206.     prme();
  207.     spoteffects();
  208.     /* to cover for a case where mtmp is not in a next square */
  209.     if(um_dist(mtmp->mx,mtmp->my,1))
  210.         pline("Brrooaa...  You land hard at some distance.");
  211. }
  212.  
  213. #endif /* OVLB */
  214. #ifdef OVL0
  215.  
  216. /*
  217.  * mattacku: monster attacks you
  218.  *    returns 1 if monster dies (e.g. "yellow light"), 0 otherwise
  219.  *    Note: if you're displaced or invisible the monster might attack the
  220.  *        wrong position...
  221.  *    Assumption: it's attacking you or an empty square; if there's another
  222.  *        monster which it attacks by mistake, the caller had better
  223.  *        take care of it...
  224.  */
  225. int
  226. mattacku(mtmp)
  227.     register struct monst *mtmp;
  228. {
  229.     struct    attack    *mattk;
  230.     int    i, j, tmp, sum[NATTK];
  231.     struct    permonst *mdat = mtmp->data;
  232.     boolean ranged = (dist(mtmp->mx, mtmp->my) > 3);
  233.         /* Is it near you?  Affects your actions */
  234.     boolean range2 = !monnear(mtmp, mtmp->mux, mtmp->muy);
  235.         /* Does it think it's near you?  Affects its actions */
  236.     boolean foundyou = (mtmp->mux==u.ux && mtmp->muy==u.uy);
  237.         /* Is it attacking you or your image? */
  238.     boolean youseeit = (cansee(mtmp->mx, mtmp->my));
  239.         /* Necessary since if it's attacking your image around a
  240.          * corner, you might not see it
  241.          */
  242.  
  243.     if(!ranged) nomul(0);
  244.     if(mtmp->mhp <= 0) return(0);
  245.  
  246.     /* If swallowed, can only be affected by u.ustuck */
  247.     if(u.uswallow) {
  248.         if(mtmp != u.ustuck)
  249.         return(0);
  250.         u.ustuck->mux = u.ux;
  251.         u.ustuck->muy = u.uy;
  252.         range2 = 0;
  253.         foundyou = 1;
  254.         /* This is not impossible! */
  255.         /* If the swallowing monster changes into a monster
  256.          * that is not capable of swallowing you, you get
  257.          * regurgitated - dgk
  258.          *
  259.          * This code is obsolete: newcham() will handle this contingency 
  260.          * as soon as it occurs in the course of a round. - kcd
  261.          *
  262.          * for(i = 0; i < NATTK; i++)
  263.          *     if(mdat->mattk[i].aatyp == AT_ENGL) goto doattack;
  264.          *
  265.          * You("get regurgitated!");
  266.          * regurgitates(mtmp);
  267.              * return(0);
  268.          */
  269.     }
  270. /* doattack:        use commented out above */
  271. #ifdef POLYSELF
  272.     if (u.uundetected && !range2 && foundyou && !u.uswallow) {
  273.         u.uundetected = 0;
  274.         if (u.usym == S_PIERCER) {
  275.             coord cc; /* maybe we need a unexto() function? */
  276.  
  277.             unpmon(mtmp);
  278.             remove_monster(mtmp->mx, mtmp->my);
  279.             place_monster(mtmp, u.ux, u.uy);
  280.             pmon(mtmp);
  281.             (void) enexto(&cc, u.ux, u.uy, &playermon);
  282.             teleds(cc.x, cc.y);
  283.             You("fall from the ceiling!");
  284.             if (is_mercenary(mtmp->data) && m_carrying(mtmp,HELMET)) {
  285.             kludge("Your blow glances off %s's helmet.",
  286.                                 mon_nam(mtmp));
  287.             } else {
  288.             if (3 + mtmp->data->ac <= rnd(20)) {
  289.                 kludge("%s is hit by a falling piercer (you)!",
  290.                                 Monnam(mtmp));
  291.                 if ((mtmp->mhp -= d(3,6)) < 1)
  292.                 killed(mtmp);
  293.             } else
  294.               kludge("%s is almost hit by a falling piercer (you)!",
  295.                                     Monnam(mtmp));
  296.             }
  297.         } else {
  298.             if (Blind) pline("It tries to move where you are hiding.");
  299.             else
  300.              pline("Wait, %s!  There's a %s named %s hiding under %s!",
  301.             mtmp->mnamelth ? NAME(mtmp) : mtmp->data->mname,
  302.             uasmon->mname, plname,
  303.             OBJ_AT(u.ux,u.uy)
  304.                ? doname(level.objects[u.ux][u.uy]) :
  305.                "some gold");
  306.             prme();
  307.         }
  308.         return(0);
  309.     }
  310.     if (u.usym == S_MIMIC_DEF && !range2 && foundyou && !u.uswallow) {
  311.         if (Blind) pline("It gets stuck on you.");
  312.             else pline("Wait, %s!  That's a %s named %s!",
  313.             mtmp->mnamelth ? NAME(mtmp) : mtmp->data->mname,
  314.             uasmon->mname, plname);
  315.         u.ustuck = mtmp;
  316.         u.usym = S_MIMIC;
  317.         prme();
  318.         return(0);
  319.     }
  320. #endif
  321. /*    Work out the armor class differential    */
  322.     tmp = u.uac + 10;        /* tmp ~= 0 - 20 */
  323. /*    give people with Ac < -9 at least some vulnerability */
  324. /*    negative AC gives an actual AC of somewhere from -1 to the AC */
  325.     if (tmp < 10) tmp = 10 - rnd(10-tmp);
  326.     tmp += mtmp->m_lev;
  327.     if(multi < 0) tmp += 4;
  328.     if((Invis && !perceives(mdat)) || !mtmp->mcansee)
  329.         tmp -= 2;
  330.     if(mtmp->mtrapped) tmp -= 2;
  331.     if(tmp <= 0) tmp = 1;
  332.  
  333.     /* make eels visible the moment they hit/miss us */
  334.     if(mdat->mlet == S_EEL && mtmp->minvis && cansee(mtmp->mx,mtmp->my)) {
  335.         mtmp->minvis = 0;
  336.         pmon(mtmp);
  337.     }
  338.  
  339. /*    Special demon handling code */
  340.     if(!mtmp->cham && is_demon(mdat) && !range2
  341. #ifdef INFERNO
  342.        && mtmp->data != &mons[PM_BALROG]
  343.        && mtmp->data != &mons[PM_SUCCUBUS]
  344.        && mtmp->data != &mons[PM_INCUBUS]
  345. #endif
  346.        )
  347.         if(!mtmp->mcan && !rn2(13))    dsummon(mdat);
  348.  
  349. /*    Special lycanthrope handling code */
  350.     if(!mtmp->cham && is_were(mdat) && !range2) {
  351.  
  352.         if(is_human(mdat)) {
  353.         if(!rn2(5 - (night() * 2)) && !mtmp->mcan) new_were(mtmp);
  354.         } else if(!rn2(30) && !mtmp->mcan) new_were(mtmp);
  355.  
  356.         if(!rn2(10) && !mtmp->mcan) {
  357.         if(!Blind) {
  358.             pline("%s summons help!",youseeit ?
  359.                 Monnam(mtmp) : "It");
  360.         } else
  361.             You("feel hemmed in.");
  362.         /* Technically wrong; we really should check if you can see the
  363.          * help, but close enough...
  364.          */
  365.         if (!were_summon(mdat,FALSE) && !Blind)
  366.             pline("But none comes.");
  367.         }
  368.     }
  369.  
  370.     for(i = 0; i < NATTK; i++) {
  371.  
  372.         sum[i] = 0;
  373.         mattk = &(mdat->mattk[i]);
  374.         if (u.uswallow && (mattk->aatyp != AT_ENGL))
  375.         continue;
  376.         switch(mattk->aatyp) {
  377.         case AT_CLAW:    /* "hand to hand" attacks */
  378.         case AT_KICK:
  379.         case AT_BITE:
  380.         case AT_STNG:
  381.         case AT_TUCH:
  382.         case AT_BUTT:
  383.             if(!range2) {
  384.                 if (foundyou) {
  385.                 if(tmp > (j = rnd(20+i))) {
  386. #ifdef POLYSELF
  387.                     if (mattk->aatyp != AT_KICK ||
  388.                         !thick_skinned(uasmon))
  389. #endif
  390.                     sum[i] = hitmu(mtmp, mattk);
  391.                 } else
  392.                     missmu(mtmp, (tmp == j), mattk);
  393.                 } else
  394.                 wildmiss(mtmp);
  395.             }
  396.             break;
  397.  
  398.         case AT_HUGS:    /* automatic if prev two attacks succeed */
  399.             /* Note: if displaced, prev attacks never succeeded */
  400.             if((!range2 && i>=2 && sum[i-1] && sum[i-2])
  401.                             || mtmp == u.ustuck)
  402.                 sum[i]= hitmu(mtmp, mattk);
  403.             break;
  404.  
  405.         case AT_GAZE:    /* can affect you either ranged or not */
  406.             if (youseeit)
  407.                 /* not displaced around a corner so not visible */
  408.                 sum[i] = gazemu(mtmp, mattk);
  409.             break;
  410.  
  411.         case AT_EXPL:    /* automatic hit if next to, and aimed at you */
  412.             if(!range2) {
  413.                 if (foundyou)
  414.                 sum[i] = explmu(mtmp, mattk);
  415.                 else {
  416.                 if (!mtmp->mcan) {
  417.                     pline("%s explodes at a spot in thin air!",
  418.                     youseeit ? Monnam(mtmp) : "It");
  419.                     mondead(mtmp);
  420.                     sum[i] = 2;
  421.                 }
  422.                 }
  423.             }
  424.             break;
  425.  
  426.         case AT_ENGL:
  427.             if (!range2) {
  428.                 if(foundyou) {
  429.                 if(u.uswallow || tmp > (j = rnd(20+i))) {
  430.                     /* Force swallowing monster to be
  431.                      * displayed even when player is
  432.                      * moving away */
  433.                     nscr();
  434.                     sum[i] = gulpmu(mtmp, mattk);
  435.                 } else {
  436.                     missmu(mtmp, (tmp == j), mattk);
  437.                 }
  438.                            } else if (is_animal(mtmp->data))
  439.                     pline("%s gulps some air!", youseeit ?
  440.                           Monnam(mtmp) : "It");
  441.                   else
  442.                     if (youseeit)
  443.                      pline("%s lunges forward and recoils!",
  444.                            Monnam(mtmp));
  445.                     else
  446.                         You("hear a %s nearby.", 
  447.                             is_whirly(mtmp->data)? 
  448.                             "rushing noise" : 
  449.                             "\"splat!\"");
  450.             }
  451.             break;
  452.         case AT_BREA:
  453.             if(range2) sum[i] = breamu(mtmp, mattk);
  454.             /* Note: breamu takes care of displacement */
  455.             break;
  456.         case AT_SPIT:
  457.             if(range2) sum[i] = spitmu(mtmp, mattk);
  458.             /* Note: spitmu takes care of displacement */
  459.             break;
  460.         case AT_WEAP:
  461.             if(range2) {
  462. #ifdef REINCARNATION
  463.                 if (dlevel != rogue_level)
  464. #endif
  465.                     sum[i] = thrwmu(mtmp);
  466.             } else
  467.                 if (foundyou) {
  468.                 set_uasmon();
  469.                 otmp = select_hwep(mtmp);
  470.                 if(otmp) {
  471.                     tmp += hitval(otmp, uasmon);
  472.                     mswings(mtmp, otmp);
  473.                 }
  474.                 if(tmp > (j = rnd(20+i)))
  475.                     sum[i] = hitmu(mtmp, mattk);
  476.                 else
  477.                     missmu(mtmp, (tmp == j), mattk);
  478.                 } else
  479.                 wildmiss(mtmp);
  480.             break;
  481.         case AT_MAGC:
  482.             if (range2)
  483.                 sum[i] = buzzmu(mtmp, mattk);
  484.             else
  485.                 if (foundyou)
  486.                 sum[i] = castmu(mtmp, mattk);
  487.                 else
  488.                 pline("%s casts a spell at thin air!",
  489.                     youseeit ? Monnam(mtmp) : "It");
  490.                 /* Not totally right since castmu allows other
  491.                  * spells, such as the monster healing itself,
  492.                  * that should work even when not next to you--
  493.                  * but the previous code was just as wrong.
  494.                  * --KAA
  495.                  */
  496.             break;
  497.  
  498.         default:        /* no attack */
  499.             break;
  500.         }
  501.         if(flags.botl) bot();
  502.         if(sum[i] == 2)  return(1);      /* attacker dead */
  503.         if(sum[i] == 3) break;  /* attacker teleported, no more attacks */
  504.         /* sum[i] == 1: successful attack */
  505.         /* sum[i] == 0: unsuccessful attack */
  506.     }
  507.     return(0);
  508. }
  509.  
  510. #endif /* OVL0 */
  511. #ifdef OVLB
  512.  
  513. /*
  514.  * helper function for some compilers that have trouble with hitmu
  515.  */
  516.  
  517. STATIC_OVL
  518. void
  519. hurtarmor(mdat, attk)
  520. struct permonst *mdat;
  521. int attk;
  522. {
  523.     boolean getbronze, rusting;
  524.     int    hurt;
  525.  
  526.     rusting = (attk == AD_RUST);
  527.     if (rusting) {
  528.         hurt = 1;
  529.         getbronze = (mdat == &mons[PM_BLACK_PUDDING] &&
  530.                  uarm && is_corrodeable(uarm));
  531.     }
  532.     else {
  533.         hurt=2;
  534.         getbronze = FALSE;
  535.     }
  536.     /* What the following code does: it keeps looping until it
  537.      * finds a target for the rust monster.
  538.      * Head, feet, etc... not covered by metal, or covered by
  539.      * rusty metal, are not targets.  However, your body always
  540.      * is, no matter what covers it.
  541.      */
  542.     while (1) {
  543.         switch(rn2(5)) {
  544.         case 0:
  545.         if (!rust_dmg(uarmh, rusting ? "helmet" : "leather helmet",
  546.                      hurt, FALSE))
  547.             continue;
  548.         break;
  549.         case 1:
  550.         if (uarmc) break;
  551.         /* Note the difference between break and continue;
  552.          * break means it was hit and didn't rust; continue
  553.          * means it wasn't a target and though it didn't rust
  554.          * something else did.
  555.          */
  556.         if (getbronze)
  557.             (void)rust_dmg(uarm, "bronze armor", 3, TRUE);
  558.         else if (uarm)
  559.             (void)rust_dmg(uarm, xname(uarm), hurt, TRUE);
  560.         break;
  561.         case 2:
  562.         if (!rust_dmg(uarms, rusting ? "shield" : "wooden shield",
  563.                      hurt, FALSE))
  564.             continue;
  565.         break;
  566.         case 3:
  567.         if (!rust_dmg(uarmg, rusting ? "metal gauntlets" : "gloves",
  568.                      hurt, FALSE))
  569.             continue;
  570.         break;
  571.         case 4:
  572.         if (!rust_dmg(uarmf, rusting ? "metal boots" : "boots",
  573.                      hurt, FALSE))
  574.             continue;
  575.         break;
  576.         }
  577.         break; /* Out of while loop */
  578.     }
  579. }
  580.  
  581. #endif /* OVLB */
  582. #ifdef OVL1
  583.  
  584. /*
  585.  * hitmu: monster hits you
  586.  *      returns 2 if monster dies (e.g. "yellow light"), 1 otherwise
  587.  *      3 if the monster lives but teleported/paralyzed, so it can't keep
  588.  *           attacking you
  589.  */
  590. STATIC_OVL
  591. int
  592. hitmu(mtmp, mattk)
  593.     register struct monst *mtmp;
  594.     register struct attack  *mattk;
  595. {
  596.     register struct permonst *mdat = mtmp->data;
  597.     register int dmg, ctmp, ptmp;
  598.     int armpro;
  599.     char     buf[BUFSZ];
  600. #ifdef POLYSELF
  601.     struct permonst *olduasmon = uasmon;
  602.     int res;
  603. #endif
  604.  
  605. /*    If the monster is undetected & hits you.  You should know where
  606.  *    the attack came from.
  607.  */
  608.     if(mtmp->mhide && mtmp->mundetected) {
  609.         mtmp->mundetected = 0;
  610.         if(!(Blind ? Telepat : (HTelepat & WORN_HELMET))) {
  611.         register struct obj *obj;
  612.  
  613.         if(OBJ_AT(mtmp->mx, mtmp->my)) {
  614.             if(obj = level.objects[mtmp->mx][mtmp->my])
  615.             pline("%s was hidden under %s!",
  616.                   Xmonnam(mtmp), doname(obj));
  617.         } else if (levl[mtmp->mx][mtmp->my].gmask == 1)
  618.             pline("%s was hidden under some gold!",
  619.                   Xmonnam(mtmp));
  620.         }
  621.     }
  622.  
  623. /*    First determine the base damage done */
  624.     dmg = d((int)mattk->damn, (int)mattk->damd);
  625.     if(is_undead(mdat) && midnight())
  626.         dmg += d((int)mattk->damn, (int)mattk->damd); /* extra damage */
  627.  
  628. /*    Next a cancellation factor    */
  629. /*    Use ctmp when the cancellation factor takes into account certain
  630.  *    armor's special magic protection.  Otherwise just use !mtmp->mcan.
  631.  */
  632.     armpro = 0;
  633.     if (uarm && armpro < objects[uarm->otyp].a_can)
  634.         armpro = objects[uarm->otyp].a_can;
  635.     if (uarmc && armpro < objects[uarmc->otyp].a_can)
  636.         armpro = objects[uarmc->otyp].a_can;
  637.     ctmp = !mtmp->mcan && ((rn2(3) >= armpro) || !rn2(50));
  638.  
  639. /*    Now, adjust damages via resistances or specific attacks */
  640.     switch(mattk->adtyp) {
  641.         case AD_PHYS:
  642.         if(mattk->aatyp == AT_HUGS
  643. #ifdef POLYSELF
  644.                        && !sticks(uasmon)
  645. #endif
  646.                                 ) {
  647.             if(!u.ustuck && rn2(2)) {
  648.             u.ustuck = mtmp;
  649.             kludge("%s grabs you!", Monnam(mtmp));
  650.             } else if(u.ustuck == mtmp)
  651.             You("are being %s.",
  652. #ifdef GOLEMS
  653.                   (mtmp->data == &mons[PM_ROPE_GOLEM])
  654.                   ? "choked" :
  655. #endif /* GOLEMS */
  656.                   "crushed");
  657.  
  658.         } else {              /* hand to hand weapon */
  659.             hitmsg(mtmp, mattk);
  660.             if(mattk->aatyp == AT_WEAP && otmp) {
  661.             dmg += dmgval(otmp, uasmon);
  662.             if (dmg <= 0) dmg = 1;
  663. #ifdef NAMED_ITEMS
  664.             if (spec_ability(otmp, SPFX_DRLI)
  665. #  ifdef POLYSELF
  666.                         && !resists_drli(uasmon)
  667. #  endif
  668.                                     ) {
  669.                 if (Blind)
  670.                 You("feel an unholy blade drain your life!");
  671.                 else
  672.                 pline("The %s blade drains your life!",
  673.                     Hallucination ? hcolor() : black);
  674.                 losexp();
  675.             }
  676. #endif
  677. #ifdef POLYSELF
  678.             if (u.mh > 1 && u.mh > ((u.uac>0) ? dmg : dmg+u.uac) &&
  679.                     (u.umonnum==PM_BLACK_PUDDING
  680.                     || u.umonnum==PM_BROWN_PUDDING)) {
  681.                 /* This redundancy necessary because you have to
  682.                  * take the damage _before_ being cloned.
  683.                  */
  684.                 if (u.uac < 0) dmg += u.uac;
  685.                 if (dmg < 1) dmg = 1;
  686.                 u.mh -= dmg;
  687.                 flags.botl = 1;
  688.                 dmg = 0;
  689.                 if(cloneu())
  690.                 kludge("You divide as %s hits you!",mon_nam(mtmp));
  691.             }
  692.             urustm(mtmp, otmp);
  693. #endif
  694.             }
  695.         }
  696.         break;
  697.         case AD_DISE:
  698.         hitmsg(mtmp, mattk);
  699. #ifdef POLYSELF
  700.         if (u.usym == S_FUNGUS)
  701.             You("feel a slight illness.");
  702.         else
  703. #endif
  704.             You("feel very sick.");
  705.         make_sick((long)rn1(25-ACURR(A_CON),15),FALSE);
  706.         u.usick_cause = mdat->mname;
  707.         break;
  708.         case AD_FIRE:
  709.         hitmsg(mtmp, mattk);
  710.         if(ctmp) {
  711.             pline("You're on fire!");
  712.             if (Fire_resistance) {
  713.             pline("The fire doesn't feel hot!");
  714.             dmg = 0;
  715.             }
  716.             if(mtmp->m_lev > rn2(20))
  717.             destroy_item(SCROLL_SYM, AD_FIRE);
  718.             if(mtmp->m_lev > rn2(20))
  719.             destroy_item(POTION_SYM, AD_FIRE);
  720. #ifdef SPELLS
  721.             if(mtmp->m_lev > rn2(25))
  722.             destroy_item(SPBOOK_SYM, AD_FIRE);
  723. #endif
  724.         } else dmg = 0;
  725.         break;
  726.         case AD_COLD:
  727.         hitmsg(mtmp, mattk);
  728.         if(ctmp) {
  729.             pline("You're covered in frost!");
  730.             if (Cold_resistance) {
  731.             pline("The frost doesn't seem cold!");
  732.             dmg = 0;
  733.             }
  734.             if(mtmp->m_lev > rn2(20))
  735.             destroy_item(POTION_SYM, AD_COLD);
  736.         } else dmg = 0;
  737.         break;
  738.         case AD_ELEC:
  739.         hitmsg(mtmp, mattk);
  740.         if(ctmp) {
  741.             You("get zapped!");
  742.             if (Shock_resistance) {
  743.             pline("The zap doesn't shock you!");
  744.             dmg = 0;
  745.             }
  746.             if(mtmp->m_lev > rn2(20))
  747.             destroy_item(WAND_SYM, AD_ELEC);
  748.             if(mtmp->m_lev > rn2(20))
  749.             destroy_item(RING_SYM, AD_ELEC);
  750.         } else dmg = 0;
  751.         break;
  752.         case AD_SLEE:
  753.         hitmsg(mtmp, mattk);
  754.         if(ctmp && multi >= 0 && !rn2(5)) {
  755.             if (Sleep_resistance) break;
  756.             nomul(-rnd(10));
  757.             if (Blind)    You("are put to sleep!");
  758.             else    You("are put to sleep by %s!",mon_nam(mtmp));
  759.         }
  760.         break;
  761.         case AD_DRST:
  762.         ptmp = A_STR;
  763.         goto dopois;
  764.         case AD_DRDX:
  765.         ptmp = A_DEX;
  766.         goto dopois;
  767.         case AD_DRCO:
  768.         ptmp = A_CON;
  769. dopois:
  770.         hitmsg(mtmp, mattk);
  771.         if(ctmp && !rn2(8)) {
  772.             Sprintf(buf, "%s's %s",
  773.                 Hallucination ? rndmonnam() : mdat->mname,
  774.                 (mattk->aatyp == AT_BITE) ? "bite" : "sting");
  775.             poisoned(buf, ptmp, mdat->mname, 30);
  776.         }
  777.         break;
  778.         case AD_PLYS:
  779.         hitmsg(mtmp, mattk);
  780.         if(ctmp && multi >= 0 && !rn2(3)) {
  781.             if (Blind)    You("are frozen!");
  782.             else    You("are frozen by %s!", mon_nam(mtmp));
  783.             nomul(-rnd(10));
  784.         }
  785.         break;
  786.         case AD_DRLI:
  787.         hitmsg(mtmp, mattk);
  788.         if (ctmp && !rn2(3)
  789. #ifdef POLYSELF
  790.             && !resists_drli(uasmon)
  791. #endif
  792. #ifdef NAMED_ITEMS
  793.             && !defends(AD_DRLI, uwep)
  794. #endif
  795.             ) losexp();
  796.         break;
  797.         case AD_LEGS:
  798.         { register long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE;
  799.           if (mtmp->mcan) {
  800.             kludge("%s nuzzles against your %s %s!", Monnam(mtmp),
  801.               (side == RIGHT_SIDE) ? "right" : "left",
  802.               body_part(LEG));
  803.           } else {
  804.             if (uarmf) {
  805.             kludge("%s scratches your %s boot!", Monnam(mtmp),
  806.                 (side == RIGHT_SIDE) ? "right" : "left");
  807.             break;
  808.             }
  809.             kludge("%s pricks your %s %s!", Monnam(mtmp),
  810.               (side == RIGHT_SIDE) ? "right" : "left",
  811.               body_part(LEG));
  812.             set_wounded_legs(side, rnd(60-ACURR(A_DEX)));
  813.           }
  814.           break;
  815.         }
  816.         case AD_STON:    /* at present only a cockatrice */
  817.         hitmsg(mtmp, mattk);
  818.         if(!rn2(3) && !Stoned) {
  819.             if (mtmp->mcan) {
  820.             if (flags.soundok)
  821.                 You("hear a cough from %s!", Blind ? "it"
  822.                 : mon_nam(mtmp));
  823.             } else {
  824.             if (flags.soundok)
  825.                 if (Blind) You("hear its hissing!");
  826.                 else You("hear %s's hissing!", mon_nam(mtmp));
  827.             if((!rn2(10) ||
  828.                 (flags.moonphase == NEW_MOON && !have_lizard()))
  829. #ifdef POLYSELF
  830.                 && !resists_ston(uasmon)
  831. #endif
  832.                 ) {
  833.                 Stoned = 5;
  834.                 return(1);
  835.                 /* You("turn to stone..."); */
  836.                 /* done_in_by(mtmp); */
  837.             }
  838.             }
  839.         }
  840.         break;
  841.         case AD_STCK:
  842.         hitmsg(mtmp, mattk);
  843.         if(ctmp && !u.ustuck
  844. #ifdef POLYSELF
  845.                      && !sticks(uasmon)
  846. #endif
  847.                             ) u.ustuck = mtmp;
  848.         break;
  849.         case AD_WRAP:
  850.         if(ctmp
  851. #ifdef POLYSELF
  852.             && !sticks(uasmon)
  853. #endif
  854.                       ) {
  855.             if(!u.ustuck && !rn2(10)) {
  856.             kludge("%s swings itself around you!", Monnam(mtmp));
  857.             u.ustuck = mtmp;
  858.             } else if(u.ustuck == mtmp) {
  859.             if (is_pool(mtmp->mx,mtmp->my)
  860. #ifdef POLYSELF
  861.                 && !is_swimmer(uasmon)
  862. #endif
  863.                ) {
  864.                 kludge("%s drowns you...", Monnam(mtmp));
  865.                 done(DROWNING);
  866.             } else if(mattk->aatyp == AT_HUGS)
  867.                 You("are being crushed.");
  868.             } else dmg = 0;
  869.         } else dmg = 0;
  870.         break;
  871.         case AD_WERE:
  872.         hitmsg(mtmp, mattk);
  873. #ifdef POLYSELF
  874.         if (ctmp && !rn2(4) && u.ulycn == -1
  875.             && !Protection_from_shape_changers
  876. # ifdef NAMED_ITEMS
  877.             && !defends(AD_WERE,uwep)
  878. # endif
  879.             ) {
  880.             You("feel feverish.");
  881.             u.ulycn = monsndx(mdat);
  882.         }
  883. #endif
  884.         break;
  885.         case AD_SGLD:
  886.         hitmsg(mtmp, mattk);
  887. #ifdef POLYSELF
  888.         if (u.usym == mdat->mlet) break;
  889. #endif
  890.         if(!mtmp->mcan) stealgold(mtmp);
  891.         break;
  892.  
  893.         case AD_SITM:    /* for now these are the same */
  894.         case AD_SEDU:
  895. #ifdef POLYSELF
  896.         if (dmgtype(uasmon, AD_SEDU)
  897. #  ifdef SEDUCE
  898.             || dmgtype(uasmon, AD_SSEX)
  899. #  endif
  900.                         ) {
  901.             if (mtmp->minvent)
  902.     kludge("%s brags about the goods some dungeon explorer provided.",
  903.     Monnam(mtmp));
  904.             else
  905.     kludge("%s makes some remarks about how difficult theft is lately.",
  906.     Monnam(mtmp));
  907.             rloc(mtmp);
  908.             return 3;
  909.         } else
  910. #endif
  911.         if(mtmp->mcan) {
  912.             if (!Blind) {
  913.             pline("%s tries to %s you, but you seem %s.",
  914.                 Amonnam(mtmp, "plain"),
  915.                 flags.female ? "charm" : "seduce",
  916.                 flags.female ? "unaffected" : "uninterested");
  917.             }
  918.             if(rn2(3)) {
  919.             rloc(mtmp);
  920.             return 3;
  921.             }
  922.         } else {
  923.             switch (steal(mtmp)) {
  924.               case -1:
  925.             return 2;
  926.               case 0:
  927.             break;
  928.               default:
  929.             rloc(mtmp);
  930.             mtmp->mflee = 1;
  931.             return 3;
  932.             }
  933.         }
  934.         break;
  935. #ifdef SEDUCE
  936.         case AD_SSEX:
  937.         if(could_seduce(mtmp, &youmonst, mattk) == 1
  938.             && !mtmp->mcan)
  939.             if (doseduce(mtmp))
  940.             return 3;
  941.         break;
  942. #endif
  943.         case AD_SAMU:
  944.         hitmsg(mtmp, mattk);
  945.         /* when the Wiz hits, 1/20 steals the amulet */
  946.         if (!carrying(AMULET_OF_YENDOR)) break;
  947.         if (!rn2(20)) stealamulet(mtmp);
  948.         break;
  949.  
  950.         case AD_TLPT:
  951.         hitmsg(mtmp, mattk);
  952.         if(ctmp) {
  953.             if(flags.verbose)
  954.             Your("position suddenly seems very uncertain!");
  955.             tele();
  956.         }
  957.         break;
  958.         case AD_RUST:
  959.         hitmsg(mtmp, mattk);
  960.         if (mtmp->mcan) break;
  961. #if defined(POLYSELF) && defined(GOLEMS)
  962.         if (u.umonnum == PM_IRON_GOLEM) {
  963.             You("rust!");
  964.             rehumanize();
  965.             break;
  966.         }
  967. #endif
  968.         hurtarmor(mdat, AD_RUST);
  969.         break;
  970.         case AD_DCAY:
  971.         hitmsg(mtmp, mattk);
  972.         if (mtmp->mcan) break;
  973. #if defined(POLYSELF) && defined(GOLEMS)
  974.         if (u.umonnum == PM_WOOD_GOLEM ||
  975.             u.umonnum == PM_LEATHER_GOLEM) {
  976.             You("rot!");
  977.             rehumanize();
  978.             break;
  979.         }
  980. #endif
  981.         hurtarmor(mdat, AD_DCAY);
  982.         break;
  983.         case AD_HEAL:
  984.         if(!uwep
  985. #ifdef SHIRT
  986.            && !uarmu
  987. #endif
  988.            && !uarm && !uarmh && !uarms && !uarmg && !uarmc && !uarmf) {
  989.             kludge("%s hits!  (I hope you don't mind.)", Monnam(mtmp));
  990. #ifdef POLYSELF
  991.             if (u.mtimedone) {
  992.                 u.mh += rnd(7);
  993.                 if(!rn2(7)) u.mhmax++;
  994.                 if(u.mh > u.mhmax) u.mh = u.mhmax;
  995.                 if(u.mh == u.mhmax && !rn2(50)) mongone(mtmp);
  996.             } else {
  997. #endif
  998.                 u.uhp += rnd(7);
  999.                 if(!rn2(7)) u.uhpmax++;
  1000.                 if(u.uhp > u.uhpmax) u.uhp = u.uhpmax;
  1001.                 if(u.uhp == u.uhpmax && !rn2(50)) mongone(mtmp);
  1002. #ifdef POLYSELF
  1003.             }
  1004. #endif
  1005.             flags.botl = 1;
  1006.             if(!rn2(50)) rloc(mtmp);
  1007.             dmg = 0;
  1008.         } else
  1009.             if(pl_character[0] == 'H') {
  1010.                 if (flags.soundok && !(moves % 5))
  1011.                 verbalize("Doc, I can't help you unless you cooperate.");
  1012.                 dmg = 0;
  1013.             } else hitmsg(mtmp, mattk);
  1014.         break;
  1015.         case AD_CURS:
  1016.         hitmsg(mtmp, mattk);
  1017.         if(!night() && mdat == &mons[PM_GREMLIN]) break;
  1018.         if(!mtmp->mcan && !rn2(10)) {
  1019.             if (flags.soundok)
  1020.             if (Blind) You("hear laughter.");
  1021.             else       pline("%s chuckles.", Monnam(mtmp));
  1022. #ifdef POLYSELF
  1023. #ifdef GOLEMS
  1024.             if (u.umonnum == PM_CLAY_GOLEM) {
  1025.             pline("Some writing vanishes from your head!");
  1026.             rehumanize();
  1027.             break;
  1028.             }
  1029. #endif /* GOLEMS */
  1030. #endif
  1031.             attrcurse();
  1032.         }
  1033.         break;
  1034.         case AD_STUN:
  1035.         hitmsg(mtmp, mattk);
  1036.         if(!mtmp->mcan && !rn2(4)) {
  1037.             make_stunned(HStun + dmg, TRUE);
  1038.             dmg /= 2;
  1039.         }
  1040.         break;
  1041.         case AD_ACID:
  1042.         hitmsg(mtmp, mattk);
  1043.         if(!mtmp->mcan && !rn2(3))
  1044. #ifdef POLYSELF
  1045.             if (resists_acid(uasmon)) {
  1046.             pline("You're covered in acid, but it seems harmless.");
  1047.             dmg = 0;
  1048.             } else
  1049. #endif
  1050.             pline("You're covered in acid!    It burns!");
  1051.         else        dmg = 0;
  1052.         break;
  1053.         case AD_SLOW:
  1054.         hitmsg(mtmp, mattk);
  1055.         if(!ctmp && (Fast & (INTRINSIC|TIMEOUT)) && !rn2(4)) {
  1056.             Fast &= ~(INTRINSIC|TIMEOUT);
  1057.             You("feel yourself slowing down.");
  1058.         }
  1059.         break;
  1060.         case AD_DREN:
  1061.         hitmsg(mtmp, mattk);
  1062. #ifdef SPELLS
  1063.         if(!ctmp && !rn2(4)) drain_en(dmg);
  1064. #endif
  1065.         dmg = 0;
  1066.         break;
  1067. #ifdef INFERNO /* a non-gaze AD_CONF exists only for one of the demons */
  1068.         case AD_CONF:
  1069.         hitmsg(mtmp, mattk);
  1070.         if(!mtmp->mcan && !rn2(4) && !mtmp->mspec_used) {
  1071.             mtmp->mspec_used = mtmp->mspec_used + (dmg + rn2(6));
  1072.             if(Confusion)
  1073.              You("are getting even more confused.");
  1074.             else You("are getting confused.");
  1075.             make_confused(HConfusion + dmg, FALSE);
  1076.         }
  1077. #endif
  1078.         /* fall through to next case */
  1079.         default:    dmg = 0;
  1080.             break;
  1081.     }
  1082.     if(u.uhp < 1) done_in_by(mtmp);
  1083.  
  1084. /*    Negative armor class reduces damage done instead of fully protecting
  1085.  *    against hits.
  1086.  */
  1087.     if (dmg && u.uac < 0) {
  1088.         dmg -= rnd(-u.uac);
  1089.         if (dmg < 1) dmg = 1;
  1090.     }
  1091.  
  1092.     if(dmg) mdamageu(mtmp, dmg);
  1093.  
  1094. #ifdef POLYSELF
  1095.     res = passiveum(olduasmon, mtmp, mattk);
  1096.     stop_occupation();
  1097.     return res;
  1098. #else
  1099.     stop_occupation();
  1100.     return 1;
  1101. #endif
  1102. }
  1103.  
  1104. #endif /* OVL1 */
  1105. #ifdef OVLB
  1106.  
  1107. STATIC_OVL
  1108. int
  1109. gulpmu(mtmp, mattk)    /* monster swallows you, or damage if u.uswallow */
  1110.     register struct monst *mtmp;
  1111.     register struct attack  *mattk;
  1112. {
  1113.     int    tmp = d((int)mattk->damn, (int)mattk->damd);
  1114.     int    tim_tmp;
  1115. #ifdef WALKIES
  1116.     int    i;
  1117. #endif
  1118.  
  1119.     if(!u.uswallow) {    /* swallows you */
  1120. #ifdef POLYSELF
  1121.         if (uasmon->msize >= MZ_HUGE) return(0);
  1122. #endif
  1123.         remove_monster(mtmp->mx, mtmp->my);
  1124.         place_monster(mtmp, u.ux, u.uy);
  1125.         u.ustuck = mtmp;
  1126.         pmon(mtmp);
  1127.         kludge("%s engulfs you!", Monnam(mtmp));
  1128.         stop_occupation();
  1129.         if (u.utrap) {
  1130.             You("are released from the %s!",
  1131.                 u.utraptype==TT_WEB ? "web" : "trap");
  1132.             u.utrap = 0;
  1133.         }
  1134. #ifdef WALKIES
  1135.         if((i = number_leashed()) > 0) {
  1136.             pline("The leash%s snap%s loose...",
  1137.                     (i > 1) ? "es" : "",
  1138.                     (i > 1) ? "" : "s");
  1139.             unleash_all();
  1140.         }
  1141. #endif
  1142. #ifdef POLYSELF
  1143.         if (u.umonnum==PM_COCKATRICE && !resists_ston(mtmp->data)) {
  1144.             kludge("%s turns to stone!", Monnam(mtmp));
  1145.             stoned = 1;
  1146.             xkilled(mtmp, 0);
  1147.             return 2;
  1148.         }
  1149. #endif
  1150.         more();
  1151.         seeoff(1);
  1152.         u.uswallow = 1;
  1153.         /*assume that u.uswldtim always set >=0*/
  1154.         u.uswldtim = (tim_tmp =
  1155.             (-u.uac + 10 + rnd(25 - (int)mtmp->m_lev)) >> 1) > 0 ?
  1156.                 tim_tmp : 0;
  1157.         swallowed(1);
  1158.     } else {
  1159.  
  1160.         if(mtmp != u.ustuck) return(0);
  1161.         switch(mattk->adtyp) {
  1162.  
  1163.         case AD_DGST:
  1164.             if(!u.uswldtim) {    /* a3 *//*no cf unsigned <=0*/
  1165.             kludge("%s totally digests you!", Monnam(mtmp));
  1166.             tmp = u.uhp;
  1167.             } else {
  1168.             kludge("%s digests you!", Monnam(mtmp));
  1169.             }
  1170.             break;
  1171.         case AD_PHYS:
  1172.             You("are pummeled with debris!");
  1173.             break;
  1174.         case AD_ACID:
  1175. #ifdef POLYSELF
  1176.             if (resists_acid(uasmon)) {
  1177.             You("are covered with a seemingly harmless goo.");
  1178.             tmp = 0;
  1179.             } else
  1180. #endif
  1181.             if (Hallucination) pline("Ouch!  You've been slimed!");
  1182.             else You("are covered in slime!  It burns!");
  1183.             break;
  1184.         case AD_BLND:
  1185.             if(!Blind) {
  1186.             You("can't see in here!");
  1187.             make_blinded((long)tmp,FALSE);
  1188.             } else make_blinded(Blinded+1,FALSE);    /* keep him blind until disgorged */
  1189.             tmp = 0;
  1190.             break;
  1191.         case AD_ELEC:
  1192.             if(!mtmp->mcan && rn2(2)) {
  1193.             pline("The air around you crackles with electricity.");
  1194.             if (Shock_resistance) {
  1195.                 shieldeff(u.ux, u.uy);
  1196.                 You("seem unhurt.");
  1197. #if defined(POLYSELF) && defined(GOLEMS)
  1198.                 ugolemeffects(AD_ELEC,tmp);
  1199. #endif
  1200.                 tmp = 0;
  1201.             }
  1202.             } else tmp = 0;
  1203.             break;
  1204.         case AD_COLD:
  1205.             if(!mtmp->mcan && rn2(2)) {
  1206.             if (Cold_resistance) {
  1207.                 shieldeff(u.ux, u.uy);
  1208.                 You("feel mildly chilly.");
  1209. #if defined(POLYSELF) && defined(GOLEMS)
  1210.                 ugolemeffects(AD_COLD,tmp);
  1211. #endif
  1212.                 tmp = 0;
  1213.             } else You("are freezing to death!");
  1214.             } else tmp = 0;
  1215.             break;
  1216.         case AD_FIRE:
  1217.             if(!mtmp->mcan && rn2(2)) {
  1218.             if (Fire_resistance) {
  1219.                 shieldeff(u.ux, u.uy);
  1220.                 You("feel mildly hot.");
  1221. #if defined(POLYSELF) && defined(GOLEMS)
  1222.                 ugolemeffects(AD_FIRE,tmp);
  1223. #endif
  1224.                 tmp = 0;
  1225.             } else You("are burning to a crisp!");
  1226.             } else tmp = 0;
  1227.             break;
  1228. #ifdef INFERNO
  1229.         case AD_DISE:
  1230.             if (!Sick) You("feel very sick.");
  1231.             make_sick(Sick + (long)rn1(25-ACURR(A_CON),15),FALSE);
  1232.             u.usick_cause = mtmp->data->mname;
  1233.             break;
  1234. #endif
  1235.         default:    tmp = 0;
  1236.                 break;
  1237.         }
  1238.     }
  1239.  
  1240.     mdamageu(mtmp, tmp);
  1241.     if(tmp) stop_occupation();
  1242.     if(u.uswldtim) --u.uswldtim;
  1243.     if(!u.uswldtim
  1244. #ifdef POLYSELF
  1245.         || u.umonnum==PM_COCKATRICE
  1246.         || uasmon->msize >= MZ_HUGE
  1247. #endif
  1248.         ) {
  1249. #ifdef POLYSELF
  1250.         if (u.umonnum == PM_COCKATRICE) {
  1251.         kludge("%s very hurriedly %s you!", Monnam(mtmp), 
  1252.                is_animal(mtmp->data)? "regurgitates" : "expels");
  1253.         u.uswldtim = 0;
  1254.         } else {
  1255. #endif
  1256.         You("get %s!", 
  1257.             is_animal(mtmp->data)? "regurgitated" : "expelled");
  1258.         if(flags.verbose && is_animal(mtmp->data))
  1259.             kludge("Obviously %s doesn't like your taste.",
  1260.                    mon_nam(mtmp));
  1261. #ifdef POLYSELF
  1262.         }
  1263. #endif
  1264.         expels(mtmp, mtmp->data, FALSE);
  1265.     }
  1266.     return(1);
  1267. }
  1268.  
  1269. STATIC_OVL
  1270. int
  1271. explmu(mtmp, mattk)    /* monster explodes in your face */
  1272.     register struct monst *mtmp;
  1273.     register struct attack  *mattk;
  1274. {
  1275.     register int tmp = d((int)mattk->damn, (int)mattk->damd);
  1276.  
  1277.     if(mtmp->mcan) return(0);
  1278.     if(!Blind)    kludge("%s explodes!", Monnam(mtmp));
  1279.     else        pline("It explodes!");
  1280.  
  1281.     switch(mattk->adtyp) {
  1282.         case AD_COLD:
  1283.         if(Cold_resistance) {
  1284.             You("seem unaffected by it.");
  1285. #if defined(POLYSELF) && defined(GOLEMS)
  1286.             ugolemeffects(AD_COLD,tmp);
  1287. #endif
  1288.             tmp = 0;
  1289.         } else {
  1290.             if(ACURR(A_DEX) > rnd(20)) {
  1291.                 if (flags.verbose)
  1292.                     You("get blasted!");
  1293.             } else {
  1294.                 You("duck the blast...");
  1295.                 tmp /= 2;
  1296.             }
  1297.         }
  1298.         break;
  1299.         case AD_BLND:
  1300.         if(!Blind
  1301. #ifdef POLYSELF
  1302.             && u.usym != S_YLIGHT
  1303. #endif
  1304.             ) {
  1305.             You("are blinded by a blast of light!");
  1306.             make_blinded((long)tmp,FALSE);
  1307.         }
  1308.         tmp = 0;
  1309.         break;
  1310.         default: break;
  1311.     }
  1312.     mdamageu(mtmp, tmp);
  1313.     mondead(mtmp);
  1314.     return(2);    /* it dies */
  1315. }
  1316.  
  1317. STATIC_OVL
  1318. int
  1319. gazemu(mtmp, mattk)    /* monster gazes at you */
  1320.     register struct monst *mtmp;
  1321.     register struct attack  *mattk;
  1322. {
  1323.     switch(mattk->adtyp) {
  1324. #ifdef MEDUSA
  1325.         case AD_STON:
  1326.         if (mtmp->mcan) {
  1327.             You("notice that %s isn't all that ugly.",mon_nam(mtmp));
  1328.            break;
  1329.         }
  1330.         if (canseemon(mtmp)) {
  1331.             You("look upon %s.", mon_nam(mtmp));
  1332. # ifdef POLYSELF
  1333.             if (resists_ston(uasmon)) {
  1334.                 pline("So what?");
  1335.                 break;
  1336.             }
  1337. # endif
  1338.             You("turn to stone...");
  1339.             killer_format = KILLED_BY_AN;
  1340.             killer = mons[PM_MEDUSA].mname;
  1341.             done(STONING);
  1342.             }
  1343.         break;
  1344. #endif
  1345.         case AD_CONF:
  1346.         if(!mtmp->mcan && canseemon(mtmp) && mtmp->mcansee && 
  1347.                     !mtmp->mspec_used && rn2(5)) {
  1348.             int conf = d(3,4);
  1349.  
  1350.             mtmp->mspec_used = mtmp->mspec_used + (conf + rn2(6));
  1351.             if(!Confusion)
  1352.             pline("%s's gaze confuses you!", Monnam(mtmp));
  1353.             else
  1354.             You("are getting more and more confused.");
  1355.             make_confused(HConfusion + conf, FALSE);
  1356.         }
  1357.         break;
  1358. #ifdef INFERNO
  1359.         case AD_STUN:
  1360.         if(!mtmp->mcan && canseemon(mtmp) && mtmp->mcansee &&
  1361.                     !mtmp->mspec_used && rn2(5)) {
  1362.             int stun = d(2,6);
  1363.  
  1364.             pline("%s stares piercingly at you!", Monnam(mtmp));
  1365.             mtmp->mspec_used = mtmp->mspec_used + (stun + rn2(6));
  1366.             make_stunned(HStun + stun, TRUE);
  1367.         }
  1368.         break;
  1369. #endif
  1370.         default: impossible("Gaze attack %d?", mattk->adtyp);
  1371.         break;
  1372.     }
  1373.     return(1);
  1374. }
  1375.  
  1376. #endif /* OVLB */
  1377. #ifdef OVL1
  1378.  
  1379. void
  1380. mdamageu(mtmp, n)    /* mtmp hits you for n points damage */
  1381.     register struct monst *mtmp;
  1382.     register int n;
  1383. {
  1384. #ifdef POLYSELF
  1385.     if (u.mtimedone) {
  1386.         u.mh -= n;
  1387.         flags.botl = 1;
  1388.         if (u.mh < 1) rehumanize();
  1389.         return;
  1390.     }
  1391. #endif
  1392.     u.uhp -= n;
  1393.     flags.botl = 1;
  1394.     if(u.uhp < 1)
  1395.         done_in_by(mtmp);
  1396. }
  1397.  
  1398. #endif /* OVL1 */
  1399. #ifdef OVLB
  1400.  
  1401. #ifdef POLYSELF
  1402. STATIC_OVL void
  1403. urustm(mon, obj)
  1404. register struct monst *mon;
  1405. register struct obj *obj;
  1406. {
  1407.     boolean vis = cansee(mon->mx, mon->my);
  1408.  
  1409.     if (!mon || !obj) return; /* just in case */
  1410.     if (u.umonnum == PM_RUST_MONSTER &&
  1411.                 objects[obj->otyp].oc_material == METAL &&
  1412.                 obj->spe > -2) {
  1413.         if(obj->rustfree) {
  1414.             if (vis)
  1415.             pline("The rust vanishes from %s's weapon!",
  1416.                                 mon_nam(mon));
  1417.         } else if(obj->blessed && rn2(3)) {
  1418.             if (vis)
  1419.             pline("Somehow, %s's weapon is not affected!",
  1420.                                 mon_nam(mon));
  1421.         } else {
  1422.             if (vis)
  1423.             pline("%s's %s!", Monnam(mon), aobjnam(obj,"corrode"));
  1424.             obj->spe--;
  1425.         }
  1426.     }
  1427. }
  1428. #endif
  1429.  
  1430. #endif /* OVLB */
  1431. #ifdef OVL1
  1432.  
  1433. int
  1434. could_seduce(magr,mdef,mattk)
  1435. struct monst *magr, *mdef;
  1436. struct attack *mattk;
  1437. /* returns 0 if seduction impossible,
  1438.  *       1 if fine,
  1439.  *       2 if wrong gender for nymph */
  1440. {
  1441.     register struct permonst *pagr, *pdef;
  1442.     boolean agrinvis, defperc;
  1443.     xchar genagr, gendef;
  1444.  
  1445.     if(magr == &youmonst) {
  1446.         pagr = uasmon;
  1447.         agrinvis = (Invis != 0);
  1448.         genagr = poly_gender();
  1449.     } else {
  1450.         pagr = magr->data;
  1451.         agrinvis = magr->minvis;
  1452.         genagr = gender(magr);
  1453.     }
  1454.     if(mdef == &youmonst) {
  1455.         pdef = uasmon;
  1456.         defperc = (See_invisible != 0);
  1457.         gendef = poly_gender();
  1458.     } else {
  1459.         pdef = mdef->data;
  1460.         defperc = perceives(pdef);
  1461.         gendef = gender(mdef);
  1462.     }
  1463.  
  1464.     if(agrinvis && !defperc
  1465. #ifdef SEDUCE
  1466.         && mattk && mattk->adtyp != AD_SSEX
  1467. #endif
  1468.         )
  1469.         return 0;
  1470.  
  1471.     if(pagr->mlet != S_NYMPH
  1472. #ifdef INFERNO
  1473.         && ((pagr != &mons[PM_INCUBUS] && pagr != &mons[PM_SUCCUBUS])
  1474. # ifdef SEDUCE
  1475.             || (mattk && mattk->adtyp != AD_SSEX)
  1476. # endif
  1477.            )
  1478. #endif
  1479.         )
  1480.         return 0;
  1481.     
  1482.     if(genagr == 1 - gendef)
  1483.         return 1;
  1484.     else
  1485.         return (pagr->mlet == S_NYMPH) ? 2 : 0;
  1486. }
  1487.  
  1488. #endif /* OVL1 */
  1489. #ifdef OVLB
  1490.  
  1491. #ifdef SEDUCE
  1492. /* Returns 1 if monster teleported */
  1493. int
  1494. doseduce(mon)
  1495. register struct monst *mon;
  1496. {
  1497.     register struct obj *ring;
  1498.     boolean fem = (mon->data == &mons[PM_SUCCUBUS]); /* otherwise incubus */
  1499.  
  1500.     if (mon->mcan || mon->mspec_used) {
  1501.           pline("%s acts as though %s has got a %sheadache.",
  1502.               Blind ? "It" : Monnam(mon), Blind ? "it" :
  1503.               fem ? "she" : "he",
  1504.             mon->mcan ? "severe " : "");
  1505.         return 0;
  1506.     }
  1507.  
  1508.     if (unconscious()) {
  1509.         kludge("%s seems dismayed at your lack of response.",
  1510.             Monnam(mon));
  1511.         return 0;
  1512.     }
  1513.  
  1514.     if (Blind) pline("It caresses you...");
  1515.     else You("feel very attracted to %s.", mon_nam(mon));
  1516.  
  1517.     for(ring = invent; ring; ring = ring->nobj) {
  1518.         if (ring->otyp != RIN_ADORNMENT) continue;
  1519.         if (fem) {
  1520.         if (rn2(20) < ACURR(A_CHA)) {
  1521.             pline("\"That %s looks pretty.  May I have it?\" ",
  1522.             xname(ring));
  1523.             makeknown(RIN_ADORNMENT);
  1524.             if (yn() == 'n') continue;
  1525.         } else pline("%s decides she'd like your %s, and takes it.",
  1526.             Blind ? "She" : Monnam(mon), xname(ring));
  1527.         makeknown(RIN_ADORNMENT);
  1528.         if (ring==uleft || ring==uright) Ring_gone(ring);
  1529.         if (ring==uwep) setuwep((struct obj *)0);
  1530.         freeinv(ring);
  1531.         mpickobj(mon,ring);
  1532.         } else {
  1533.         char buf[BUFSZ];
  1534.  
  1535.         if (uleft && uright && uleft->otyp == RIN_ADORNMENT
  1536.                 && uright->otyp==RIN_ADORNMENT)
  1537.             break;
  1538.         if (ring==uleft || ring==uright) continue;
  1539.         if (rn2(20) < ACURR(A_CHA)) {
  1540.             pline("\"That %s looks pretty.  Would you wear it for me?\" ",
  1541.             xname(ring));
  1542.             makeknown(RIN_ADORNMENT);
  1543.             if (yn() == 'n') continue;
  1544.         } else {
  1545.             pline("%s decides you'd look prettier wearing your %s,",
  1546.             Blind ? "He" : Monnam(mon), xname(ring));
  1547.             pline("and puts it on your finger.");
  1548.         }
  1549.         makeknown(RIN_ADORNMENT);
  1550.         if (!uright) {
  1551.             pline("%s puts the %s on your right hand.",
  1552.             Blind ? "He" : Monnam(mon), xname(ring));
  1553.             setworn(ring, RIGHT_RING);
  1554.         } else if (!uleft) {
  1555.             pline("%s puts the %s on your left hand.",
  1556.             Blind ? "He" : Monnam(mon), xname(ring));
  1557.             setworn(ring, LEFT_RING);
  1558.         } else if (uright && uright->otyp != RIN_ADORNMENT) {
  1559.             Strcpy(buf, xname(uright));
  1560.             pline("%s replaces your %s with your %s.",
  1561.             Blind ? "He" : Monnam(mon), buf, xname(ring));
  1562.             Ring_gone(uright);
  1563.             setworn(ring, RIGHT_RING);
  1564.         } else if (uleft && uleft->otyp != RIN_ADORNMENT) {
  1565.             Strcpy(buf, xname(uleft));
  1566.             pline("%s replaces your %s with your %s.",
  1567.             Blind ? "He" : Monnam(mon), buf, xname(ring));
  1568.             Ring_gone(uleft);
  1569.             setworn(ring, LEFT_RING);
  1570.         } else impossible("ring replacement");
  1571.         Ring_on(ring);
  1572.             prinv(ring);
  1573.         }
  1574.     }
  1575.  
  1576.     if (!uarmc && !uarmf && !uarmg && !uarms && !uarmh
  1577. #ifdef SHIRT
  1578.                                 && !uarmu
  1579. #endif
  1580.                                     )
  1581.         pline("%s murmurs sweet nothings into your ear.",
  1582.             Blind ? (fem ? "She" : "He") : Monnam(mon));
  1583.     else
  1584.         pline("%s murmurs in your ear, while helping you undress.",
  1585.             Blind ? (fem ? "She" : "He") : Monnam(mon));
  1586.     mayberem(uarmc, "cloak");
  1587.     if(!uarmc)
  1588.         mayberem(uarm, "suit");
  1589.     mayberem(uarmf, "boots");
  1590.     mayberem(uarmg, "gloves");
  1591.     mayberem(uarms, "shield");
  1592.     mayberem(uarmh, "helmet");
  1593. #ifdef SHIRT
  1594.     if(!uarmc && !uarm)
  1595.         mayberem(uarmu, "shirt");
  1596. #endif
  1597.  
  1598.     if (uarm || uarmc) {
  1599.         pline("\"You're such a %s; I wish...\"",
  1600.                 flags.female ? "sweet lady" : "nice guy");
  1601.         rloc(mon);
  1602.         return 1;
  1603.     }
  1604. #define ALIGNLIM     (5L + (moves/200L)) /* from pray.c */
  1605.     if (u.ualigntyp == U_CHAOTIC && u.ualign < ALIGNLIM) u.ualign++;
  1606.  
  1607.     /* by this point you have discovered mon's identity, blind or not... */
  1608.     pline("Time stands still while you and %s lie in each other's arms...",
  1609.         mon_nam(mon));
  1610.     if (rn2(35) > ACURR(A_CHA) + ACURR(A_INT)) {
  1611.         /* Don't bother with mspec_used here... it didn't get tired! */
  1612.         pline("%s seems to have enjoyed it more than you...",
  1613.             Monnam(mon));
  1614. #ifdef SPELLS
  1615.         switch (rn2(5)) {
  1616.             case 0: You("feel drained of energy.");
  1617.                 u.uen = 0;
  1618.                 u.uenmax -= rnd(10);
  1619.                 if (u.uenmax < 0) u.uenmax = 0;
  1620.                 break;
  1621. #else
  1622.         switch (rnd(4)) {
  1623. #endif
  1624.             case 1: You("are down in the dumps.");
  1625.                 adjattrib(A_CON, -1, TRUE);
  1626.                 flags.botl = 1;
  1627.                 break;
  1628.             case 2: Your("senses are dulled.");
  1629.                 adjattrib(A_WIS, -1, TRUE);
  1630.                 flags.botl = 1;
  1631.                 break;
  1632.             case 3:
  1633. #ifdef POLYSELF
  1634.                 if (resists_drli(uasmon))
  1635.                     You("have a curious feeling...");
  1636.                 else {
  1637. #endif
  1638.                     You("feel out of shape.");
  1639.                     losexp();
  1640.                     if(u.uhp <= 0) {
  1641.                     killer_format = KILLED_BY;
  1642.                     killer = "overexertion";
  1643.                     done(DIED);
  1644.                     }
  1645. #ifdef POLYSELF
  1646.                 }
  1647. #endif
  1648.                 break;
  1649.             case 4: You("feel exhausted.");
  1650.                 losehp(5+rnd(10), "exhaustion", KILLED_BY);
  1651.                 break;
  1652.         }
  1653.     } else {
  1654.         mon->mspec_used = rnd(100); /* monster is worn out */
  1655.         You("seem to have enjoyed it more than %s...", mon_nam(mon));
  1656. #ifdef SPELLS
  1657.         switch (rn2(5)) {
  1658.             case 0: You("feel raised to your full potential.");
  1659.                 u.uen = (u.uenmax += rnd(5));
  1660.                 break;
  1661. #else
  1662.         switch (rnd(4)) {
  1663. #endif
  1664.             case 1: You("feel good enough to do it again.");
  1665.                 adjattrib(A_CON, 1, TRUE);
  1666.                 flags.botl = 1;
  1667.                 break;
  1668.             case 2: You("will always remember %s...", mon_nam(mon));
  1669.                 adjattrib(A_WIS, 1, TRUE);
  1670.                 flags.botl = 1;
  1671.                 break;
  1672.             case 3: pline("That was a very educational experience.");
  1673.                 pluslvl();
  1674.                 break;
  1675.             case 4: You("feel restored to health!");
  1676.                 u.uhp = u.uhpmax;
  1677. #ifdef POLYSELF
  1678.                 if (u.mtimedone) u.mh = u.mhmax;
  1679. #endif
  1680.                 flags.botl = 1;
  1681.                 break;
  1682.         }
  1683.     }
  1684.  
  1685.     if (mon->mtame) /* don't charge */ ;
  1686.     else if (rn2(20) < ACURR(A_CHA)) {
  1687.         pline("%s demands that you pay %s, but you refuse...",
  1688.             Monnam(mon), (fem ? "her" : "him"));
  1689.     }
  1690. #ifdef POLYSELF
  1691.     else if (u.umonnum == PM_LEPRECHAUN)
  1692.         pline("%s tries to take your money, but fails...",
  1693.                 Monnam(mon));
  1694. #endif
  1695.     else {
  1696.         long cost = (long)rnd(
  1697.             (int)(u.ugold > 32757L ? 32757 : u.ugold) +10) + 500;
  1698.  
  1699.         if (mon->mpeaceful) {
  1700.             cost /= 5;
  1701.             if (!cost) cost=1;
  1702.         }
  1703.         if (cost > u.ugold) cost = u.ugold;
  1704.         if (!cost) verbalize("It's on the house!");
  1705.         else {
  1706.             pline("%s takes %ld zorkmid%s for services rendered!",
  1707.                 Monnam(mon), cost, plur(cost));
  1708.             u.ugold -= cost;
  1709.             mon->mgold += cost;
  1710.             flags.botl = 1;
  1711.         }
  1712.     }
  1713.     if (!rn2(25)) mon->mcan = 1; /* monster is worn out */
  1714.     rloc(mon);
  1715.     return 1;
  1716. }
  1717.  
  1718. static void
  1719. mayberem(obj, str)
  1720. register struct obj *obj;
  1721. const char *str;
  1722. {
  1723.     if (!obj || !obj->owornmask) return;
  1724.  
  1725.     if (rn2(20) < ACURR(A_CHA)) {
  1726.         pline("\"Shall I remove your %s, %s?\" ",
  1727.             str,
  1728.             (!rn2(2) ? "lover" : !rn2(2) ? "dear" : "sweetheart"));
  1729.         if (yn() == 'n') return;
  1730.     } else pline("\"Take off your %s; %s.\"", str,
  1731.             (obj == uarm)  ? "let's get a little closer" :
  1732.             (obj == uarmc || obj == uarms) ? "it's in the way" :
  1733.             (obj == uarmf) ? "let me rub your feet" :
  1734.             (obj == uarmg) ? "they're too clumsy" :
  1735. #ifdef SHIRT
  1736.             (obj == uarmu) ? "let me massage you" :
  1737. #endif
  1738.             /* obj == uarmh */
  1739.             "let me run my fingers through your hair");
  1740.  
  1741.     if (donning(obj)) cancel_don();
  1742.     if (obj == uarm)  (void) Armor_off();
  1743.     else if (obj == uarmc) (void) Cloak_off();
  1744.     else if (obj == uarmf) (void) Boots_off();
  1745.     else if (obj == uarmg) (void) Gloves_off();
  1746.     else if (obj == uarmh) (void) Helmet_off();
  1747.     else setworn((struct obj *)0, obj->owornmask & W_ARMOR);
  1748. }
  1749. #endif  /* SEDUCE */
  1750.  
  1751. #endif /* OVLB */
  1752.  
  1753. #ifdef POLYSELF
  1754.  
  1755. #ifdef OVL1
  1756.  
  1757. static int
  1758. passiveum(olduasmon,mtmp,mattk)
  1759. struct permonst *olduasmon;
  1760. register struct monst *mtmp;
  1761. register struct attack *mattk;
  1762. {
  1763.     register struct permonst *mdat = mtmp->data;
  1764.     int i;
  1765.     int dam = 0;
  1766.  
  1767.     for(i = 0; ; i++) {
  1768.         if(i >= NATTK) return 1;
  1769.         if(olduasmon->mattk[i].aatyp == AT_NONE) break;
  1770.     }
  1771.  
  1772.     /* These affect the enemy even if you were "killed" (rehumanized) */
  1773.     switch(olduasmon->mattk[i].adtyp) {
  1774.         case AD_ACID:
  1775.         if (!rn2(2)) {
  1776.             kludge("%s is splashed by your acid!", Monnam(mtmp));
  1777.             if(!resists_acid(mdat))
  1778.             dam = d((int)olduasmon->mlevel+1,
  1779.                     (int)olduasmon->mattk[i].damd);
  1780.             else pline("%s is not affected.", Monnam(mtmp));
  1781.         }
  1782.         break;
  1783.         case AD_STON: /* cockatrice */
  1784.         if (!resists_ston(mdat) &&
  1785.             (mattk->aatyp != AT_WEAP || !select_hwep(mtmp)) &&
  1786.             mattk->aatyp != AT_GAZE && mattk->aatyp != AT_EXPL &&
  1787.             mattk->aatyp != AT_MAGC &&
  1788.             (!is_mercenary(mdat) ||
  1789.                       !m_carrying(mtmp, LEATHER_GLOVES))) {
  1790.             kludge("%s turns to stone!", Monnam(mtmp));
  1791.             stoned = 1;
  1792.             xkilled(mtmp, 0);
  1793.             return 2;
  1794.         }
  1795.         default:
  1796.         break;
  1797.     }
  1798.     if (!u.mtimedone) return 1;
  1799.  
  1800.     /* These affect the enemy only if you are still a monster */
  1801.     if (rn2(3)) switch(uasmon->mattk[i].adtyp) {
  1802.         case AD_PLYS: /* Floating eye */
  1803.         {int tmp = d((int)uasmon->mlevel+1, (int)uasmon->mattk[i].damd);
  1804.         if (u.umonnum == PM_FLOATING_EYE) {
  1805.             if (!rn2(4)) tmp = 120;
  1806.             if (mtmp->mcansee && rn2(3) &&
  1807.                 (perceives(mdat) || !Invis)) {
  1808.             if (Blind)
  1809.                 pline("As a blind %s, you cannot defend yourself.",
  1810.                             uasmon->mname);
  1811.                 else {
  1812.                 pline("%s is frozen by your gaze!", Monnam(mtmp));
  1813.                 mtmp->mcanmove = 0;
  1814.                 mtmp->mfrozen = tmp;
  1815.                 return 3;
  1816.             }
  1817.             }
  1818.         } else { /* gelatinous cube */
  1819.             kludge("%s is frozen by you.", Monnam(mtmp));
  1820.             mtmp->mcanmove = 0;
  1821.             mtmp->mfrozen = tmp;
  1822.             return 3;
  1823.         }
  1824.         break;
  1825.         }
  1826.         case AD_COLD: /* Brown mold or blue jelly */
  1827.         dam = d((int)uasmon->mlevel+1, (int)uasmon->mattk[i].damd);
  1828.         if(resists_cold(mdat)) {
  1829.               shieldeff(mtmp->mx, mtmp->my);
  1830.             kludge("%s is mildly chilly.", Monnam(mtmp));
  1831. #ifdef GOLEMS
  1832.             golemeffects(mtmp, AD_COLD, dam);
  1833. #endif /* GOLEMS */
  1834.             dam = 0;
  1835.             break;
  1836.         }
  1837.         kludge("%s is suddenly very cold!", Monnam(mtmp));
  1838.         u.mh += dam / 2;
  1839.         if (u.mhmax < u.mh) u.mhmax = u.mh;
  1840.         if (u.mhmax > ((uasmon->mlevel+1) * 8)) {
  1841.             register struct monst *mon;
  1842.  
  1843.             if (mon = cloneu()) {
  1844.                 mon->mhpmax = u.mhmax /= 2;
  1845.                 if (Blind)
  1846.                 You("multiply from its heat!");
  1847.                 else
  1848.                 You("multiply from %s's heat!", mon_nam(mtmp));
  1849.             }
  1850.         }
  1851.         break;
  1852.         case AD_STUN: /* Yellow mold */
  1853.         if (!mtmp->mstun) {
  1854.             mtmp->mstun = 1;
  1855.             kludge("%s staggers.", Monnam(mtmp));
  1856.         }
  1857.         break;
  1858.         case AD_FIRE: /* Red mold */
  1859.         dam = d((int)uasmon->mlevel+1, (int)uasmon->mattk[i].damd);
  1860.         if(resists_fire(mdat)) {
  1861.               shieldeff(mtmp->mx, mtmp->my);
  1862.             kludge("%s is mildly warm.", Monnam(mtmp));
  1863. #ifdef GOLEMS
  1864.             golemeffects(mtmp, AD_FIRE, dam);
  1865. #endif /* GOLEMS */
  1866.             dam = 0;
  1867.             break;
  1868.         }
  1869.         kludge("%s is suddenly very hot!", Monnam(mtmp));
  1870.         default: break;
  1871.     }
  1872.  
  1873.     if((mtmp->mhp -= dam) <= 0) {
  1874.         kludge("%s dies!", Monnam(mtmp));
  1875.         xkilled(mtmp,0);
  1876.         return 2;
  1877.     }
  1878.     return 1;
  1879. }
  1880.  
  1881. #endif /* OVL1 */
  1882. #ifdef OVLB
  1883.  
  1884. #include "edog.h"
  1885. struct monst *
  1886. cloneu()
  1887. {
  1888.     register struct monst *mon;
  1889.  
  1890.     if (u.mh <= 1) return(struct monst *)0;
  1891.     uasmon->pxlth += sizeof(struct edog);
  1892.     mon = makemon(uasmon, u.ux, u.uy);
  1893.     uasmon->pxlth -= sizeof(struct edog);
  1894.     mon = christen_monst(mon, plname);
  1895.     initedog(mon);
  1896.     mon->m_lev = uasmon->mlevel;
  1897.     mon->mhp = u.mh /= 2;
  1898.     mon->mhpmax = u.mhmax;
  1899.     return(mon);
  1900. }
  1901.  
  1902. #endif /* OVLB */
  1903.  
  1904. #endif /* POLYSELF */
  1905.  
  1906.